// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//    * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//    * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//    * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=2e3bce3171a6a740c5d8371376880be296399cb7$
//

#ifndef CEF_INCLUDE_CAPI_CEF_WEB_STORAGE_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_WEB_STORAGE_CAPI_H_
#pragma once

#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_callback_capi.h"

#ifdef __cplusplus
extern "C" {
#endif

struct _cef_get_origins_callback_t;

///
/// Structure to implement to be notified of asynchronous completion via
/// cef_web_storage_t::GetSavedPasswords.
///
typedef struct _cef_get_saved_passwords_callback_t {
  ///
  /// Base structure.
  ///
  cef_base_ref_counted_t base;

  ///
  /// Method that will be called upon completion.
  ///
  void(CEF_CALLBACK* on_complete)(
      struct _cef_get_saved_passwords_callback_t* self,
      cef_string_list_t url,
      cef_string_list_t username);
} cef_get_saved_passwords_callback_t;

///
/// Structure to implement to be notified of asynchronous completion via
/// cef_web_storage_t::GetOriginQuota.
///
typedef struct _cef_get_origin_usage_or_quota_callback_t {
  ///
  /// Base structure.
  ///
  cef_base_ref_counted_t base;

  ///
  /// Method that will be called upon completion.
  ///
  void(CEF_CALLBACK* on_complete)(
      struct _cef_get_origin_usage_or_quota_callback_t* self,
      int64 nums);
} cef_get_origin_usage_or_quota_callback_t;

///
/// Structure to implement to be notified of asynchronous completion via
/// cef_web_storage_t::get_origins().
///
typedef struct _cef_get_origins_callback_t {
  ///
  /// Base structure.
  ///
  cef_base_ref_counted_t base;

  ///
  /// Method that will be called upon Origins completion.
  ///
  void(CEF_CALLBACK* on_origins)(struct _cef_get_origins_callback_t* self,
                                 cef_string_list_t origins);

  ///
  /// Method that will be called upon Usages completion.
  ///
  void(CEF_CALLBACK* on_usages)(struct _cef_get_origins_callback_t* self,
                                cef_string_list_t usages);

  ///
  /// Method that will be called upon Quotas completion.
  ///
  void(CEF_CALLBACK* on_quotas)(struct _cef_get_origins_callback_t* self,
                                cef_string_list_t quotas);

  ///
  /// Method that will be called upon completion.
  ///
  void(CEF_CALLBACK* on_complete)(struct _cef_get_origins_callback_t* self);
} cef_get_origins_callback_t;

///
/// Structure to implement to be notified of asynchronous completion via
/// cef_web_storage_t::GetPassword.
///
typedef struct _cef_get_password_callback_t {
  ///
  /// Base structure.
  ///
  cef_base_ref_counted_t base;

  ///
  /// Method that will be called upon completion.
  ///
  void(CEF_CALLBACK* on_complete)(struct _cef_get_password_callback_t* self,
                                  const cef_string_t* result);
} cef_get_password_callback_t;

///
/// Structure used for managing storage. The functions of this structure may be
/// called on any thread unless otherwise indicated.
///
typedef struct _cef_web_storage_t {
  ///
  /// Base structure.
  ///
  cef_base_ref_counted_t base;

  ///
  /// Clears all storage currently being used by the JavaScript storage APIs.
  ///
  void(CEF_CALLBACK* delete_all_data)(struct _cef_web_storage_t* self);

  ///
  /// Clears the storage currently being used by the Web SQL Database APIs by
  /// the given origin.
  ///
  void(CEF_CALLBACK* delete_origin)(struct _cef_web_storage_t* self,
                                    const cef_string_t* origin);

  ///
  /// Gets the origins currently using the Web SQL Database APIs.
  ///
  void(CEF_CALLBACK* get_origins)(struct _cef_web_storage_t* self,
                                  struct _cef_get_origins_callback_t* callback);

  ///
  /// Gets the storage quota for the Web SQL Database API for the given origin.
  ///
  void(CEF_CALLBACK* get_origin_quota)(
      struct _cef_web_storage_t* self,
      const cef_string_t* origin,
      struct _cef_get_origin_usage_or_quota_callback_t* callback);

  ///
  /// Gets the amount of storage currently being used by the Web SQL Database
  /// APIs by the given origin.
  ///
  void(CEF_CALLBACK* get_origin_usage)(
      struct _cef_web_storage_t* self,
      const cef_string_t* origin,
      struct _cef_get_origin_usage_or_quota_callback_t* callback);

  ///
  /// clear password
  ///
  void(CEF_CALLBACK* clear_password)(struct _cef_web_storage_t* self);

  ///
  /// remove save pssword by url and username
  ///
  void(CEF_CALLBACK* remove_password)(struct _cef_web_storage_t* self,
                                      const cef_string_t* url,
                                      const cef_string_t* username);

  ///
  /// modify save pssword by url
  ///
  void(CEF_CALLBACK* modify_password)(struct _cef_web_storage_t* self,
                                      const cef_string_t* url,
                                      const cef_string_t* old_username,
                                      const cef_string_t* new_username,
                                      const cef_string_t* new_password);

  ///
  /// remove password by host url
  ///
  void(CEF_CALLBACK* remove_password_by_url)(struct _cef_web_storage_t* self,
                                             const cef_string_t* url);

  ///
  /// Get password by url and username
  ///
  void(CEF_CALLBACK* get_password)(
      struct _cef_web_storage_t* self,
      const cef_string_t* url,
      const cef_string_t* username,
      struct _cef_get_password_callback_t* callback);

  ///
  /// Get password by url and username
  ///
  void(CEF_CALLBACK* get_saved_passwords_info)(
      struct _cef_web_storage_t* self,
      struct _cef_get_saved_passwords_callback_t* callback);
} cef_web_storage_t;

///
/// Returns the global web storage.
///
CEF_EXPORT cef_web_storage_t* cef_web_storage_get_global_manager(
    struct _cef_completion_callback_t* callback);

///
/// Returns the global web storage in incognito mode.
///
CEF_EXPORT cef_web_storage_t* cef_web_storage_get_global_incognito_manager(
    struct _cef_completion_callback_t* callback);

#ifdef __cplusplus
}
#endif

#endif  // CEF_INCLUDE_CAPI_CEF_WEB_STORAGE_CAPI_H_
